"Z-80 Microcomputer Design Projects" By William Barden, Jr. Copyright 1980 (Preface and Table of Contents Overview) Preface ------- This book is dedicated to one proposition-that it is relatively easy to use today's microprocessors, "computers on a chip," to perform a variety of sophisticated tasks. The digital computer has made the transition from paraphernalia that required government funding to build and use, to a circuit component that is used in hundreds of applications. Microprocessor chips are "designed into" mixers, radio tuners, microwave ovens, and many other devices. The microprocessor has become a standard engineering building block, just as vacuum tubes and flip-flops were standard components several years ago. The appeal of a microprocessor over discrete logic is that a microprocessor does not have to be dedicated to performing a single defined task. Because a microprocessor is a computer, by its very nature it is a general-purpose device. The same circuitry may be programmed to perform any number of functions. Rather than designing a dozen separate circuits to perform a dozen separate functions, the computer program may simply be changed to perform each function. This book, Z-80 Microcomputer Design Projects, may be used by the electronics enthusiast who has a background in electronics other than microprocessors as a training course in microprocessor fundamentals. It may be used by the interested nontechnician to let him or her see how easy it really is to construct a complete microcomputer. It may be used by the hobbyist who wants to use a microcomputer primarily for the application or end result. This book provides a step-by-step guide in building a complete microcomputer, the EZ-80, and for implementing a number of different applications. Although some kit-building experience may be of help, every attempt has been made to provide a trouble-free guide to construction even for the neophyte. The applications range from a music synthesizer that will play one-voice musical scores with special effects, to a Morse code generator that generates code for practice or transmission, to a telephone dialer, to a timer that times external events over 100 days. Each application is fully documented in detail. For those readers who are interested in implementing their own unique applications, this book provides the ground work in programming methods so that they may create their own programmed "applications packages" using the input and output lines of the microcomputer to talk to the external world. The EZ-80 Microcomputer is built around the popular Z-80 microprocessor chip. The Z-80 microprocessor is a complete computer on a chip. It has a repertoire of hundreds of instructions and operates at speeds of up to hundreds of thousands of operations per second. In addition to the Z-80, about 12 other semiconductor devices are used. Some of these are memory, others enable the Z-80 to interface to the outside world, and others perform clocking and control functions. The complete set of parts to build the EZ-80 may be purchased for about $50-inexpensive indeed for the processing power that is available. Two methods of construction are possible. The microcomputer may be wire-wrapped using simple techniques and tools. Alternatively, plans are provided for a printed-circuit board construction for those readers who have the wherewithal to produce printed circuits. Total construction time using wire-wrapping is approximately 20 hours. The book is divided into three sections. Section 1 covers the hardware and software basics of the Z-80 microprocessor. Since the microcomputer is built around the Z-80, discussion of the hardware signals and operation of the microprocessor are essential to a complete understanding of the microcomputer. Similarly, the programs presented in the book all use the built-in instruction set of the Z-80, and a discussion of basic Z-80 instructions is helpful in understanding operation of the microcomputer programs for the application. Section 2 describes the EZ-80 microcomputer built from the Z-80. The relationship of the Z-80 to other system components, such as memory, peripheral interface, and clock, is explored. Complete construction details on the EZ-80 are presented in this section. If you choose to program or "burn in" an applications program in the EPROM (Erasable Programmable Read-Only Memory) chip, you may do so by constructing the simple auxiliary EPROM programmer described in this section (or you may choose one of several other alternatives). A diagnostic program and step-by-step troubleshooting procedures are also provided in this section. These help in checkout of the EZ-80 after construction has been completed, and verify that the EZ-80 is working properly. Section 3 describes the applications that may be implemented with the EZ-80. A Morse Code Generator is described that will generate random code characters for code practice, and a Morse Code Sender that will send predefined messages is also discussed. Speed may be varied as desired. A Music Synthesizer is defined that will play prerecorded or user-defined scores. The envelope of the notes may be shaped to create special effects. A Timer with presets is described that enables six outputs with programmable times from seconds to days. Two security applications, a Burglar Alarm and Combination Lock, are described. The Burglar Alarm monitors five inputs for switch closures and provides an audio alarm and visual report. The Combination Lock provides a virtually unbreakable combination that may be used to open doors or for control functions. A Frequency Counter/Tachometer application describes a general counter that counts at rates of less than one event per second to tens of thousands of events per second. A Telephone Dialer application provides automatic dialing of a number of commonly used telephone numbers. A Microcomputer Educator program permits the user to construct his or her own assembly-language program to learn the basics of this type of programming. All of the applications presented in Section 3 are described in detail with complete applications programs that are ready to be used. Section 3 also describes how the user may implement other EZ-80 control projects, perform distributed processing and implement intelligent controllers using the EZ-80. A complete set of appendices provides information on binary and hexadecimal number systems and the Z-80 instruction set. The projects in this book are really a starting point in two senses. Firstly, they will convince the reader that it is possible to use a microprocessor in place of a great deal of other electronic circuitry and to have as a result a much more adaptable piece of equipment. Secondly, they may give the reader the initiative to implement his or her own projects, using the EZ-80 as a high-speed computer communicating with the external world. Special thanks are due John Albu for his pc board artwork. William Barden, Jr. To Barb, John, Jon, and Danny Table of Contents Overview -------------------------- Section 1: EZ-80 Theory - Chapter 1: EZ-80 Component Parts - Chapter 2: The CPU Section - Chapter 3: The Memory Section - Chapter 4: The I/O Section - Chapter 5: Z-80 Assembly Language Instruction Types - Chapter 6: Z-80 Assembly Language - Addressing and Formats Section 2: EZ-80 Construction - Chapter 7: Construction of the EZ-80 - Chapter 8: Programming the EPROMs - Chapter 9: A Diagnostic Program for the EZ-80 Section 3: EZ-80 Projects - Chapter 10: EZ-80 Applications Programs - Chapter 11: Microcomputer Educator - Chapter 12: Combination Lock - Chapter 13: Burglar Alarm - Chapter 14: Morse Code Generator - Chapter 15: Morse Code Sender - Chapter 16: Telephone Dialer - Chapter 17: Frequency Counter/Tachometer - Chapter 18: Timer - Chapter 19: Music Synthesizer - Chapter 20: Blue Sky Projects Appendices - Appendix A: Binary Operations - Appendix B: Hexadecimal Operations - Appendix C: Conversion Tables for Decimal 0-255 - Appendix D: Z-80 Instruction Set - Appendix E: Z-80 Operation Code Listings - Appendix F: EZ-80 PC Board Layout